home *** CD-ROM | disk | FTP | other *** search
- Unit dd3drop;
-
- Interface
-
- Uses dd3str;
- Function DropString(line : word) : String;
- Function DropBoolean(line : word) : boolean;
- function DropInteger(line : word) : longint;
- procedure ReadDrop(filename : string);
- procedure deletedroplist;
-
- Implementation
-
- Type
- ListPtr = ^List;
- List = Record
- Value : String[80];
- Next : ListPtr;
-
- End;
- var
-
- listhead : listptr;
-
- Function DropString( line : word ) : String;
- Var
- N : ListPtr;
- cnt: word;
- Begin
- N := ListHead;
- cnt := 1;
- While( N <> nil ) Do
- Begin
- If line = cnt Then
- Begin
- DropString := N^.Value;
- Exit;
- End;
- N := N^.Next;
- inc(cnt);
- End;
- DropString := '';
- End;
-
- Function DropInteger( line : word ) : LongInt;
- Var
- V : LongInt;
- Begin
- V := Str_To_Int(DropString(line));
- If V = -1 then V := 0;
- DropInteger := V;
- End;
-
- Function DropBoolean( line : word) : Boolean;
- Var
- S : String;
- I : LongInt;
- Begin
- S := dropString( line );
- I := dropInteger( line );
- S := Upper(S);
- dropBoolean := false;
- If( S = 'YES' ) Then dropBoolean := True;
- If( S = 'Y' ) Then dropBoolean := True;
- If( S = 'TRUE' ) Then dropBoolean := True;
- If( S = 'T' ) Then dropBoolean := True;
- If( S = 'ON' ) Then dropBoolean := True;
- If( S = 'GR' ) then dropboolean := True;
- If( I > 0 ) Then dropBoolean := True;
- If( S = 'NO' ) Then dropBoolean := False;
- If( S = 'N' ) Then dropBoolean := False;
- If( S = 'FALSE' ) Then dropBoolean := False;
- If( S = 'F' ) Then dropBoolean := False;
- If( S = 'OFF' ) Then dropBoolean := False;
- End;
-
- procedure additem(temp : string);
- var
- SPF,SPF1 : listptr;
- begin
- new(SPF);
- SPF^.value := temp;
- SPF^.next := nil;
- if listhead = nil then listhead := SPF
- else begin
- SPF1 := listhead;
- while SPF1^.next <> nil do
- SPF1 := SPF1^.next;
- SPF1^.next := SPF;
- end; {else}
- end;
-
- procedure deletedroplist;
- var
- s,s1 : listptr;
- begin
- s := listhead;
- While s <> Nil Do
- Begin
- s1 := s;
- s := s^.Next;
- Dispose(s1);
- End;
- listhead := nil;
- end;
-
-
- Procedure ReadDrop(filename : string);
- Var
- F : Text;
- S : String;
- N : Listptr;
- I : Integer;
- C : Char;
- Begin
- If ListHead <> nil then Exit;
-
- Assign( F, filename);
- {$I-} Reset( F ); {$I+}
- If IOResult <> 0 Then Exit;
-
- While Not EOF( F ) do
- Begin
- Readln( F, S );
- additem(s);
- End;
-
- Close( F );
- End;
-
- Begin
- ListHead := nil;
- End.
-